﻿using System;
using System.Collections.Generic;
using System.Text;

using libReadWrite;
using libCommonClass;

namespace TTServer.Messages
{
    class NMSAuthentificationResponseMessage: TTMessage
    {
        /// <summary>
        /// ////////////////////////////////////////////////
        /// Type = 0 --> Text = notice message
        /// Type = 1 --> Text = tempSecretString (authentication successful)
        /// Type = 2 --> Text = error message (authentication failed)
        /// </summary>
        /// 

        public static byte TYPE_NORMAL = 0;
        public static byte TYPE_SUCCESSFUL = 1;
        public static byte TYPE_FAILED = 2;

        private byte _type;

        public byte Type
        {
            get { return _type; }
            set { _type = value; }
        }

        private string _text;

        public string Text
        {
            get { return _text; }
            set { _text = value; }
        }

        public NMSAuthentificationResponseMessage()
        {

        }

        public NMSAuthentificationResponseMessage(byte type, string text)
        {
            this._type = type;
            this._text = text;
        }

        public override void ReadMessage(BigEndianReader sr)
        {
            throw new NotImplementedException();
        }

        public override void WriteMessage(BigEndianWriter sw)
        {
            sw.Write((byte)MessageKind.NMS_AUTHENTICATION_RESPONSE);
            sw.Write(Global.NO_LENGTH_CODE);
            sw.Write(_type);
            sw.WriteString(_text);
        }

        public override TTMessage Clone()
        {
            return new NMSAuthentificationResponseMessage();
        }

        public override int GetMessageID()
        {
            return MessageKind.NMS_AUTHENTICATION_RESPONSE;
        }

        public override string GetMessageName()
        {
            return "NMSAuthentificationResponse";
        }
    }
}
